home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Graphics / Utility / GL Viewer 1.1.1 / src ƒ / xlib.h < prev   
Text File  |  1993-09-05  |  5KB  |  308 lines

  1. #ifndef H_xlib
  2. #define H_xlib
  3.  
  4. /*
  5.   xlib.h
  6.   mac hack at X window calls
  7.   oct91
  8. */
  9.  
  10. #include <Types.h>
  11.  
  12. typedef     char Bool;
  13.  
  14. #define    DoRed    1
  15. #define    DoBlue    2
  16. #define    DoGreen    4
  17.  
  18. #define XYBitmap     1
  19. #define XYPixmap    2
  20. #define    ZPixmap        3
  21. #define TextImage    4
  22.  
  23. #define    LSBFirst    0
  24. #define    MSBFirst    1
  25. #define    AllocNone    0
  26.  
  27. typedef     int* Colormap;
  28. typedef     char* Pixmap;
  29. typedef     int Display;
  30. typedef     Pixmap Drawable; // Pixmap is used as drawable in some places...
  31. typedef     Pixmap Window;
  32. typedef     int xCursor;
  33. typedef     int GC;
  34. typedef     int Visual;
  35. typedef     int VisualID;
  36.  
  37.  
  38. typedef struct {
  39.     int    x,y;
  40.     int    width,height;
  41.     } XRectangle;
  42.     
  43. typedef struct {
  44.     unsigned long    pixel;
  45.     unsigned short    red,green,blue;
  46.     char    flags;
  47.     char    pad;
  48.     } XColor;
  49.     
  50. typedef    struct    _XImage {
  51.     int width,height;    // size of image
  52.     int xoffset;        //num pixels offset in X direction
  53.     int format;        //XYBitmap,XYPixmap,ZPixmap,TextImage
  54.     char *data;        // ptr to image
  55.     int byte_order;        //data byte order LSB/MSBFirst
  56.     int bitmap_unit;    //scanline 8/16/32
  57.     int bitmap_bit_order;    //LSB/MSBFirst
  58.     int bitmap_pad;        // 8/16/32 for Pixmaps
  59.     int depth;        //depth of image
  60.     int bytes_per_line;    //
  61.     int bits_per_pixel;    //ZPixmap
  62.     unsigned long red_mask;    //
  63.     unsigned long green_mask;
  64.     unsigned long blue_mask;
  65.     char *obdata;        //hook for object routines
  66.     struct funcs {        //image manip routines
  67.         struct _XImage *(*create_image)();
  68.         int (*destroy_image)();
  69.         unsigned long (*get_pixel)();
  70.         int (*put_pixel)();
  71.         struct _XImage *(*sub_image)();
  72.         int (*add_pixel)();
  73.         } f;
  74.     } XImage;
  75.     
  76.     
  77. typedef     struct {
  78.     Pixmap background_pixmap;
  79.     unsigned long background_pixel;
  80.     Pixmap border_pixmap;
  81.     unsigned long border_pixel;
  82.     int bit_gravity;
  83.     int win_gravity;
  84.     int backing_store;
  85.     unsigned long backing_planes;
  86.     unsigned long backing_pixel;
  87.     Bool save_under;
  88.     long event_mask;
  89.     long do_not_propogate_mask;
  90.     Bool override_redirect;
  91.     Colormap colormap;
  92.     xCursor cursor;
  93.     } XSetWindowAttributes;
  94.  
  95. typedef     struct {
  96.     Visual *visual;
  97.     VisualID visualid;
  98.     int screen;
  99.     unsigned int depth;
  100.     int class;
  101.     unsigned long red_mask;
  102.     unsigned long green_mask;
  103.     unsigned long blue_mask;
  104.     int colormap_size;
  105.     int bits_per_rgb;
  106.     } XVisualInfo;
  107.  
  108.     
  109. #define        XSync(dsp, flag)                
  110. #define        XSetClipMask(dsp, gc, a)            
  111. #define        XSetClipRectangles(dsp, gc, a,b,c,d,e)
  112. #define        XDrawImageString(dsp, win, gc, a,b,c,d)     
  113. #define        XDrawString(dsp, win, gc, x,y, s, slen)
  114. #define     XFreeColormap(dsp, cmap)
  115. #define     XMapWindow(dsp, win)
  116. #define     XCreateWindow(dsp, win, x, y, w, h, z, d, io, vis, bs, xswa) (Window)NULL
  117. #define     XMoveResizeWindow(dsp, win,  x,  y,  w,  h)
  118. #define     XUnmapWindow(dsp, win)
  119. #define     XDestroyWindow(dsp, win)
  120. #if 0
  121. #define     XDrawLine(dsp, win, gc, x1, y1, x2, y2)
  122. #define     XDrawPoint(dsp, win, gc, x, y)
  123. #endif
  124.  
  125.  
  126. XImage *XCreateImage(
  127.     Display *dsp,
  128.     Visual *vis,
  129.     unsigned int depth,
  130.     int format,
  131.     int offset,
  132.     char *data,
  133.     unsigned int width,
  134.     unsigned int height,
  135.     int bitmap_pad,
  136.     int bytes_per_line);
  137.     
  138. void XPutImage(
  139.     Display *dsp,
  140.     Drawable win,
  141.     GC gc,
  142.     XImage *image,
  143.     int src_x,
  144.     int src_y,
  145.     int dest_x,
  146.     int dest_y,
  147.     unsigned int width,
  148.     unsigned int height);
  149.  
  150. void XCopyArea(
  151.     Display *dsp,
  152.     Drawable src,
  153.     Drawable dest,
  154.     GC gc,
  155.     int src_x,
  156.     int src_y,
  157.     unsigned int width,
  158.     unsigned int height,
  159.     int dest_x,
  160.     int dest_y);
  161.  
  162. Pixmap XCreatePixmap(
  163.     Display *dsp,
  164.     Drawable win,
  165.     unsigned int width,
  166.     unsigned int height,
  167.     unsigned int depth);
  168.     
  169. void XFreePixmap(
  170.     Display *dsp,
  171.     Pixmap pix);
  172.  
  173. Display *XOpenDisplay(
  174.     char* name);
  175.     
  176. void XCloseDisplay(
  177.     Display *dsp);
  178.  
  179. int XResizeWindow(
  180.     Display *dsp,
  181.     Drawable win,
  182.     unsigned int width,
  183.     unsigned int height);
  184.  
  185. void XSetWindowColormap(
  186.     Display *dsp,
  187.     Drawable win,
  188.     Colormap cmap);
  189.  
  190. int XAllocColorCells(
  191.     Display *dsp,
  192.     Colormap  cmap,
  193.     Bool  contig,
  194.     unsigned long plane_masks_return[],
  195.     unsigned int nplanes,
  196.     unsigned long pixels_return[],
  197.     unsigned int npixels);
  198.  
  199. void XStoreColors(
  200.     Display *dsp,
  201.     Colormap  cmap,
  202.     XColor color[],
  203.     int  ncolors);
  204.     
  205. Colormap XCreateColormap(     
  206.     Display *dsp,
  207.     Window win,
  208.     Visual *vis,
  209.     int allocflag);
  210.  
  211. void XSetForeground(
  212.     Display *dsp,
  213.     GC gc,
  214.     unsigned long foreground);
  215.     
  216. void XSetBackground(
  217.     Display *dsp,
  218.     GC gc,
  219.     unsigned long background);
  220.     
  221. void XFillRectangle(
  222.     Display *dsp,
  223.     Drawable win,
  224.     GC gc,
  225.     int x,
  226.     int y,
  227.     int width,
  228.     int height);
  229.     
  230. void XFillRectangles(
  231.     Display *dsp,
  232.     Drawable win,
  233.     GC gc,
  234.     XRectangle *rects,
  235.     int nrects);
  236.  
  237. void XDrawLine(
  238.     Display *dsp,
  239.     Drawable win,
  240.     GC gc,
  241.     int x1,
  242.     int y1,
  243.     int x2,
  244.     int y2);
  245.  
  246. void XDrawPoint(
  247.     Display *dsp,
  248.     Drawable win,
  249.     GC gc,
  250.     int x,
  251.     int y);
  252.  
  253. void XExit (
  254.     int status);
  255.  
  256. void XSetBlackAndWhite (
  257.     Display *dsp, Drawable win);
  258.  
  259. #if 1
  260.  
  261. enum
  262. {
  263.     FillStippled,
  264.     FillSolid
  265. };
  266.  
  267. void XSetFillStyle (
  268.     Display *dsp,
  269.     GC gc,
  270.     int    fill_style);
  271.  
  272. void XSetStipple (
  273.     Display *dsp,
  274.     GC gc,
  275.     Pixmap stipple);
  276.  
  277. void XSetTSOrigin (
  278.     Display *dsp,
  279.     GC gc,
  280.     int ts_x_origin,
  281.     int ts_y_origin);
  282.  
  283. #else
  284.  
  285. #define        XSetFillStyle(dsp, gc, a);
  286. #define        XSetStipple(dsp, gc, pix)
  287. #define        XSetTSOrigin(dsp, gc, x, y)
  288.  
  289. #endif
  290.  
  291.  
  292. Bool optionKeyIsDown();
  293. Bool capsLockIsDown();
  294. Bool shiftKeyIsDown();
  295. Bool cmdKeyIsDown();
  296. Bool StopKey();
  297. Bool MouseButton();
  298. Bool Keypress(int *pKeypressed);
  299. int  usleep( unsigned long usec);
  300. long hundredthsofseconds();
  301.  
  302. char *StdGetFile(
  303.     char*  prompt,
  304.     OSType fileTypes[],
  305.     int    nFileTypes);
  306.  
  307. #endif /* H_xlib */
  308.